package com.cqw.commontest.compare.comparable;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-11-02 15:37
 * @Description:
 */
public class Test {


    public static void main(String[] args) {

        List<Dog> list = new ArrayList<>();
        list.add(new Dog("小黑", 2));
        list.add(new Dog("小白", 1));

        list.sort(Comparator.comparingInt(Dog::getAge));
        System.out.println(list);

    }


}
